<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加月度计划表出差明细</title>
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link href="/general/erp5/public/step-lay/css/layui.css" rel="stylesheet"/>
    <link href="/general/erp5/public/step-lay/step.css" rel="stylesheet">
    <link rel="stylesheet" href="/general/erp5/public/step-lay/css/default.css?t=1586046995308" media="all">
    <style>
        .layui-inline{
            margin-bottom: 15px;
            margin-right: 5px;
        }
        .layui-form-item{
            margin-bottom: 15px;
        }
        .site-text {
            position: relative;
        }
        label{
            padding: 5px 15px !important;
            height: 30px !important;
        }
        .site-title {
            margin: 0px 0 20px;
        }
        .site-title fieldset {
            border: none;
            padding: 0;
            border-top: 1px solid #eee;
        }
        .site-title fieldset legend {
            margin-left: 20px;
            padding: 0 10px;
            font-size: 16px;
            font-weight: 300;
            letter-spacing: 2px;
        }
        .site-title fieldset legend a{
            color: #333;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body" style="padding-top: 20px;">
                <form class="layui-form layui-form-pane" action="">
                    <input type = "hidden" name = "plan_id" value = "{$_GET['planid']}">
                    <div class="site-title">
                        <fieldset><legend><a name="pane">部门信息</a></legend></fieldset>
                    </div>
                    <div class="site-text">
                        <div class="layui-inline">
                            <label class="layui-form-label">一级部门&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="department1" required="" lay-verify="required" placeholder="一级部门" autocomplete="off" class="layui-input" value = "{$user_department}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">二级部门&nbsp;&nbsp;&nbsp;</label>
                            <div class="layui-input-inline">
                                <input type="text" name="department2" placeholder="若分级 则必填 否则 非必填" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">申报人&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="traveler" required="" lay-verify="required" placeholder="出差人(申报人)" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="site-title">
                        <fieldset><legend><a name="pane">出差时间</a></legend></fieldset>
                    </div>
                    <div class="site-text">
                        <div class="layui-inline">
                            <label class="layui-form-label">出差人数&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="number" name="traveler_num" placeholder="出差人数" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">开始日期&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="start_time" placeholder="出差开始日期" autocomplete="off" class="layui-input" id = "start_time">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">结束日期&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="end_time" placeholder="出差结束日期" autocomplete="off" class="layui-input" id = "end_time">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">出差天数&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="number" name="day_num" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="site-title">
                        <fieldset><legend><a name="pane">出差信息</a></legend></fieldset>
                    </div>
                    <div class="site-text">
                        <div class="layui-inline">
                            <label class="layui-form-label">出差地&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="trip_address" placeholder="出差目的地" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">客户名称&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-inline">
                                <input type="text" name="customer_name" placeholder="客户名称(A/B/C)" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">项目编号&nbsp;&nbsp;&nbsp;</label>
                            <div class="layui-input-inline">
                                <input type="text" name="contract_num" placeholder="项目合同编号" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">出差事由&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-block">
                                <textarea class="layui-textarea" name = "reason"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">出差备注&nbsp;&nbsp;&nbsp;<span style = "color: red;">*</span></label>
                            <div class="layui-input-block">
                                <textarea class="layui-textarea" name = "remark"></textarea>
                            </div>
                        </div>
                        <div class="site-title">
                            <fieldset><legend><a name="pane">出差预算(元)</a></legend></fieldset>
                        </div>
                        <div class="site-text">
                            <div class="layui-inline">
                                <label class="layui-form-label">交通费</label>
                                <div class="layui-input-inline">
                                    <input type="number" name="traffic_money" placeholder="交通费" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">住宿费</label>
                                <div class="layui-input-inline">
                                    <input type="number" name="hotel_money" placeholder="住宿费" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">餐费</label>
                                <div class="layui-input-inline">
                                    <input type="number" name="meal_money" placeholder="餐费" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">合计</label>
                                <div class="layui-input-inline">
                                    <input type="number" name="total_money" placeholder="合计" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="saveitem">立即保存</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="/general/erp5/public/step-lay/layui.js"></script>
    <script src="/general/erp5/public/step-lay/step.js"></script>
    <script>
        function getQueryString(name) {
            var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
              return unescape(r[2]);
            }
            return null;
        }
        layui.config({
            base:'/general/erp5/public/step-lay/'
        });

        layui.use([ 'form', 'step', 'table','laydate'], function () {
            var $ = layui.$
                , form = layui.form
                , table = layui.table
                , laydate = layui.laydate
                , utils=layui.utils;
            laydate.render({
                elem: '#start_time' //指定元素
            });
            laydate.render({
                elem: '#end_time' //指定元素
            });
            form.on('submit(saveitem)', function (data) {
                $.ajax({
                    url:"/general/erp5/public/travel/travelplan/SaveItem",
                    type:"POST",
                    data: data.field,
                    dataType:"json",
                    success: function(data){
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }
                });
                return false;
            });
        })
    </script>
</body>
</html>
